<template>
  <li>
		<label>
			<!-- 展示数据 -->
			<input type="checkbox" :checked="its.done" @change="setcheck(its.id)"/>
			<span>{{its.name}}</span>
		</label>
		<button class="btn btn-danger" @click="setdelete(its.id)">删除</button>
	</li>
</template>

<script>
export default {
 name:'MyItem',
 props:['its','setitems','deleteid'],
 methods:{
	setcheck(id){
    //将数据传给app
       this.setitems(id)
	},
	setdelete(id){
	//删除数据
	if(confirm('您确认删除吗'))
	  this.deleteid(id)
	}
 }
}
</script>
<style scoped>
	/*item*/
	li {
		list-style: none;
		height: 36px;
		line-height: 36px;
		padding: 0 5px;
		border-bottom: 1px solid #ddd;
	}

	li label {
		float: left;
		cursor: pointer;
	}

	li label li input {
		vertical-align: middle;
		margin-right: 6px;
		position: relative;
		top: -1px;
	}

	li button {
		float: right;
		display: none;
		margin-top: 3px;
	}

	li:before {
		content: initial;
	}

	li:last-child {
		border-bottom: none;
	}

	li:hover{
		background-color: #ddd;
	}
	
	li:hover button{
		display: block;
	}
</style>